import React, {useEffect, useState} from 'react';
import {useParams} from "react-router-dom";
import {getMessageInfoById} from "../api/message";

function Details(props) {
    const {id} = useParams();
    const [info,setInfo] = useState({});
    useEffect(()=>{
        // 根据ID获取详情
        (async ()=>{
            const result = await getMessageInfoById(id);
            setInfo(result);
        })();
    },[id])
    return (
        <div>
            <h3>{info.title}</h3>
            <p>{info.content}</p>
        </div>
    );
}

export default Details;